#pragma once

#include <queue>
#include <vector>
#include <SFML/System/Thread.hpp>
#include <SFML/System/Mutex.hpp>

typedef std::queue<short> SampleQueue;
typedef std::vector<short> SampleVector;
class Vocoder;

class ModulatorThread : public sf::Thread
{
public:
	ModulatorThread(int windowLength);
	~ModulatorThread(void);

	virtual void Start();
	virtual void Run();
	virtual void Stop();
	void NewSample(short* sample, int length);

	Vocoder* vocoder;
private:
	volatile bool isRunning;
	int windowLength;
	sf::Mutex queueMutex;
	SampleQueue buffer;
	SampleVector curSample;


	void PushAvailableSamples();


};
